From 2b416a0ddb22ffa3b790941012e70715421eebf8 Mon Sep 17 00:00:00 2001 From: Fabien Antoine Date: Sat, 6 May 2017 12:41:26 +0200 Subject: [PATCH] Refactorized code --- src/cargo/ops/cargo_read_manifest.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/cargo/ops/cargo_read_manifest.rs b/src/cargo/ops/cargo_read_manifest.rs index 91a579aff..09f8dec85 100644 --- a/src/cargo/ops/cargo_read_manifest.rs +++ b/src/cargo/ops/cargo_read_manifest.rs @@ -121,16 +121,22 @@ fn read_nested_packages(path: &Path, let manifest_path = find_project_manifest_exact(path, "Cargo.toml")?; - let result = read_manifest(&manifest_path, source_id, config); - - // Ignore malformed manifests - if result.is_err() { - info!("skipping malformed package found at `{}`", - path.to_string_lossy()); - return Ok(()); - } + let (manifest, nested) = match read_manifest(&manifest_path, source_id, config) { + Err(_) => { + // Ignore malformed manifests found on git repositories + // + // git source try to find and read all manifests from the repository + // but since it's not possible to exclude folders from this search + // it's safer to ignore malformed manifests to avoid + // + // TODO: Add a way to exclude folders? + info!("skipping malformed package found at `{}`", + path.to_string_lossy()); + return Ok(()); + } + Ok(tuple) => tuple + }; - let (manifest, nested) = result.unwrap(); let manifest = match manifest { EitherManifest::Real(manifest) => manifest, EitherManifest::Virtual(..) => return Ok(()), -- 2.30.2